home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 001-025 / scopedisk15 / qrt / docs / sample.doc < prev    next >
Text File  |  1995-03-18  |  16KB  |  595 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.         
  8.         
  9.                                QRT Sample Programs
  10.         
  11.         
  12.         Introduction
  13.         
  14.         The following are actual QRT input  files.  They can be used as a
  15.         guide to suggested QRT  indenting  style, or as a quick reference
  16.         to QRT  commands.   The  first  one  uses  most  of  the advanced
  17.         features of QRT, and would be a good example of QRT programming.
  18.         
  19.         
  20.         
  21.         
  22.         File One
  23.         
  24.            
  25.             
  26.            { ******************************************
  27.            
  28.                 QRT source for 8 spheres connected by
  29.                 reflecting cylenders.  The spheres
  30.                 form the corners of a cube.
  31.            
  32.              ****************************************** }
  33.            
  34.            FILE_NAME = object.raw
  35.            
  36.            
  37.            { ** Instance definitions for quadratics to save
  38.                 typing. These quadratics are the cylenders
  39.                 that connect the spheres                    ** }
  40.            
  41.                          
  42.            BEGIN_INSTANCES
  43.            
  44.                    QUADRATIC ( loc     = (0, 0, 0),
  45.                        name    = X_AXIS_QUAD
  46.            
  47.                        a       = 0,
  48.                        b       = 1,
  49.                        c       = 1,
  50.                        d       = 120,
  51.            
  52.                        xmin    =    0,     xmax = 100,
  53.                        ymin    =  -11,     ymax =  11,
  54.                        zmin    =  -11,     zmax =  11,
  55.            
  56.  
  57.  
  58.  
  59.  
  60.         QRT Ray Tracer               Page 1           QRT Sample Programs
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.                        diff    = ( 0,  0 , 0),
  74.                        mirror  = (.9, .9, .9),
  75.                        dither  = 0
  76.                      )
  77.            
  78.                    QUADRATIC ( loc     = (0, 0, 0),
  79.                        name    = Y_AXIS_QUAD
  80.            
  81.                        a       = 1,
  82.                        b       = 0,
  83.                        c       = 1,
  84.                        d       = 120,
  85.            
  86.                        xmin    =  -11,     xmax =  11,
  87.                        ymin    =    0,     ymax = 100,
  88.                        zmin    =  -11,     zmax =  11,
  89.            
  90.                        diff    = ( 0,  0 , 0),
  91.                        mirror  = (.9, .9, .9),
  92.                        dither  = 0
  93.                      )
  94.            
  95.                    QUADRATIC ( loc     = (0, 0, 0),
  96.                        name    = Z_AXIS_QUAD
  97.            
  98.                        a       = 1,
  99.                        b       = 1,
  100.                        c       = 0,
  101.                        d       = 120,
  102.            
  103.                        xmin    =  -11,     xmax =  11,
  104.                        ymin    =  -11,     ymax =  11,
  105.                        zmin    =    0,     zmax = 100,
  106.            
  107.                        diff    = ( 0,  0 , 0),
  108.                        mirror  = (.9, .9, .9),
  109.                        dither  = 0
  110.                      )
  111.            
  112.            
  113.            END_INSTANCES
  114.            
  115.            
  116.            { ** A pattern for the ground ** }
  117.            
  118.            PATTERN ( x_size = 50,
  119.                      y_size = 50,
  120.                      name   = CHECK,
  121.            
  122.  
  123.  
  124.  
  125.  
  126.         QRT Ray Tracer               Page 2           QRT Sample Programs
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.                      RECTANGLE (
  140.                        start_x = 0,
  141.                        start_y = 0,
  142.                        end_x   = 25,
  143.                        end_y   = 25,
  144.                        diff    = (1, .2, .2)
  145.                      )
  146.                      RECTANGLE (
  147.                        start_x = 25,
  148.                        start_y = 25,
  149.                        end_x   = 50,
  150.                        end_y   = 50,
  151.                        diff    = (1, .2, .2)
  152.                      )
  153.                    )
  154.            
  155.            
  156.            { ** The actual world starts here ** }
  157.            
  158.            BEGIN_BBOX
  159.            
  160.                BEGIN_BBOX       { ** This is the lower half ** }
  161.            
  162.                    BEGIN_BBOX
  163.            
  164.                        SPHERE ( loc = (0, 0, 0),        { ** back ** }
  165.                                 radius = 20,
  166.                                 diff = (1, .1, .1),
  167.                               )
  168.            
  169.                        SPHERE ( loc = (100, 0, 0),
  170.                                 radius = 20,
  171.                                 diff = (1, .1, .1),
  172.                               )
  173.            
  174.                        INSTANCE_OF ( name = X_AXIS_QUAD,
  175.                                      loc  = (0, 0, 0)
  176.                                    )
  177.            
  178.                    END_BBOX
  179.            
  180.                    BEGIN_BBOX                           { ** front ** }
  181.                        SPHERE ( loc = (0, 0, 100),
  182.                                 radius = 20,
  183.                                 diff = (1, .1, .1),
  184.                               )
  185.            
  186.                        SPHERE ( loc = (100, 0, 100),
  187.                                 radius = 20,
  188.                                 diff = (1, .1, .1),
  189.                               )
  190.  
  191.  
  192.         QRT Ray Tracer               Page 3           QRT Sample Programs
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.            
  206.                        INSTANCE_OF ( name = X_AXIS_QUAD,
  207.                                      loc  = (0, 0, 100)
  208.                                    )
  209.            
  210.                    END_BBOX
  211.            
  212.                    INSTANCE_OF ( name = Z_AXIS_QUAD,
  213.                                  loc  = (0, 0, 0)
  214.                                )
  215.            
  216.                    INSTANCE_OF ( name = Z_AXIS_QUAD,
  217.                                  loc  = (100, 0, 0)
  218.                                )
  219.            
  220.                END_BBOX
  221.            
  222.                BEGIN_BBOX       { ** This is the upper half ** }
  223.            
  224.                    BEGIN_BBOX                           { ** back ** }
  225.            
  226.                        SPHERE ( loc = (0, 100, 0),
  227.                                 radius = 20,
  228.                                 diff = (1, .1, .1),
  229.                               )
  230.            
  231.                        SPHERE ( loc = (100, 100, 0),
  232.                                 radius = 20,
  233.                                 diff = (1, .1, .1),
  234.                               )
  235.            
  236.                        INSTANCE_OF ( name = X_AXIS_QUAD,
  237.                                      loc  = (0, 100, 0)
  238.                                    )
  239.            
  240.                    END_BBOX
  241.            
  242.                    BEGIN_BBOX                           { ** front ** }
  243.            
  244.                        SPHERE ( loc = (0, 100, 100),
  245.                                 radius = 20,
  246.                                 diff = (1, .1, .1),
  247.                               )
  248.            
  249.                        SPHERE ( loc = (100, 100, 100),
  250.                                 radius = 20,
  251.                                 diff = (1, .1, .1),
  252.                               )
  253.            
  254.  
  255.  
  256.  
  257.  
  258.         QRT Ray Tracer               Page 4           QRT Sample Programs
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.                        INSTANCE_OF ( name = X_AXIS_QUAD,
  272.                                      loc  = (0, 100, 100)
  273.                                    )
  274.            
  275.                    END_BBOX
  276.            
  277.                    INSTANCE_OF ( name = Z_AXIS_QUAD,
  278.                                  loc  = (0, 100, 0)
  279.                                )
  280.            
  281.                    INSTANCE_OF ( name = Z_AXIS_QUAD,
  282.                                  loc  = (100, 100, 0)
  283.                                )
  284.            
  285.                END_BBOX
  286.            
  287.                { ** four vertical cylenders ** }
  288.            
  289.                INSTANCE_OF ( name = Y_AXIS_QUAD,
  290.                              loc  = (0, 0, 0)
  291.                            )
  292.            
  293.                INSTANCE_OF ( name = Y_AXIS_QUAD,
  294.                              loc  = (0, 0, 100)
  295.                            )
  296.            
  297.                INSTANCE_OF ( name = Y_AXIS_QUAD,
  298.                              loc  = (100, 0, 0)
  299.                            )
  300.            
  301.                INSTANCE_OF ( name = Y_AXIS_QUAD,
  302.                              loc  = (100, 0, 100)
  303.                            )
  304.            
  305.            END_BBOX
  306.            
  307.            PARALLELOGRAM ( loc  = (-10000, -60, -10000),
  308.                            v1   = ( 20000,   0,      0),
  309.                            v2   = (     0,   0,  20000),
  310.            
  311.                            pattern = check,
  312.                            xmult   = 2,
  313.                            ymult   = 2,
  314.                            diff    = (.1, 1, .1)
  315.                          )
  316.            
  317.            OBSERVER ( loc    = (-50, 70, 250),
  318.                       lookat = (50, 50, 50)
  319.                     )
  320.            
  321.  
  322.  
  323.  
  324.         QRT Ray Tracer               Page 5           QRT Sample Programs
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.            LAMP ( loc = (70, 250, 350),
  338.                   radius = 5,
  339.                   dist = 350
  340.                 )
  341.            
  342.            FOC_LENGTH = 70
  343.            
  344.            SKY  ( horiz  = (0, 0, .55),
  345.                   zenith = (0, 0, .25),
  346.                   dither = 4
  347.                 )
  348.            
  349.            
  350.            
  351.            File Two
  352.            
  353.            
  354.            
  355.            {**********************************
  356.            
  357.               Room - brick walls and a
  358.               mirrored sphere in the middle.
  359.            
  360.             **********************************}
  361.            
  362.            
  363.            FILE_NAME = ROOM.RAW
  364.            
  365.            
  366.            { *********   Some pattern definitions ********** }
  367.            
  368.            PATTERN ( x_size = 16,  { ** A checkered pattern ** }
  369.                      y_size = 16,
  370.                      name   = CHECK,
  371.            
  372.                      RECTANGLE (
  373.                        start_x = 0, start_y = 0,
  374.                        end_x   = 8, end_y   = 8,
  375.            
  376.                        diff    = (1, .20, .20);
  377.                      )
  378.                      RECTANGLE (
  379.                        start_x = 8, start_y = 8,
  380.                        end_x   = 16, end_y   = 16,
  381.            
  382.                        diff    = (1.00, .20, .20);
  383.                      )
  384.                    )
  385.            
  386.  
  387.  
  388.  
  389.  
  390.         QRT Ray Tracer               Page 6           QRT Sample Programs
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.            PATTERN ( x_size = 80,        { ** brick pattern ** }
  404.                      y_size = 50,
  405.                      name   = BRICK,
  406.                      RECTANGLE (
  407.                        start_x = 0, start_y = 2,
  408.                        end_x   = 18, end_y   = 23,
  409.                        diff    = (1.00, .20, .20);
  410.                      )
  411.                      RECTANGLE (
  412.                        start_x = 62, start_y = 2,
  413.                        end_x   = 80, end_y   = 23,
  414.                        diff    = (1.00, .20, .20);
  415.                      )
  416.                      RECTANGLE (
  417.                        start_x = 22, start_y = 2,
  418.                        end_x   = 58, end_y   = 23,
  419.                        diff    = (.80, .20, .20);
  420.                      )
  421.                      RECTANGLE (
  422.                        start_x = 2, start_y = 27,
  423.                        end_x   = 38, end_y   = 48,
  424.                        diff    = (.85, .35, .10);
  425.                      )
  426.                      RECTANGLE (
  427.                        start_x = 42, start_y = 27,
  428.                        end_x   = 78, end_y   = 48,
  429.                        diff    = (.70, .25, .20);
  430.                      )
  431.                    )
  432.            
  433.            
  434.            { *******   Now for the room itself  ******** }
  435.            
  436.                { ** four walls ** }
  437.            
  438.                PARALLELOGRAM ( loc  = (  0,  0, -100),
  439.                                v1   = (100,  0,    0),
  440.                                v2   = (  0, 50,    0),
  441.                                pattern = BRICK,
  442.            
  443.                                xmult = .2,
  444.                                ymult = .2
  445.                              )
  446.            
  447.                PARALLELOGRAM ( loc  = (  0,  0,  100),
  448.                                v1   = (100,  0,    0),
  449.                                v2   = (  0, 50,    0),
  450.                                pattern = BRICK,
  451.                                xmult = .2,
  452.                                ymult = .2
  453.                              )
  454.  
  455.  
  456.         QRT Ray Tracer               Page 7           QRT Sample Programs
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.            
  470.                PARALLELOGRAM ( loc  = (100,  0, -100),
  471.                                v1   = (  0,  0,  200),
  472.                                v2   = (  0, 50,    0),
  473.                                pattern = BRICK
  474.                                xmult = .2,
  475.                                ymult = .2
  476.                              )
  477.            
  478.                PARALLELOGRAM ( loc  = (  0,  0, -100),
  479.                                v1   = (  0,  0,  200),
  480.                                v2   = (  0, 50,    0),
  481.                                pattern = BRICK,
  482.                                xmult = .2,
  483.                                ymult = .2,
  484.                              )
  485.            
  486.                { ** a floor ** }
  487.            
  488.                PARALLELOGRAM ( loc  = (  0, 0,  100),
  489.                                v1   = (100, 0,    0),
  490.                                v2   = (  0, 0, -200),
  491.            
  492.                                diff = (  0, 1, 0),
  493.                                pattern = CHECK
  494.                              )
  495.            
  496.                { ** several mirrored spheres ** }
  497.            
  498.                BEGIN_BBOX
  499.            
  500.                    SPHERE    ( loc = (50, 25, -40),
  501.                                radius = 15,
  502.            
  503.                                diff   = (0, 0, 0),
  504.                                mirror = (.9, .9, .9),
  505.                                dither = 0
  506.                              )
  507.                END_BBOX
  508.            
  509.                BEGIN_BBOX
  510.            
  511.                   QUADRATIC  ( loc      = (30, 0, -20),
  512.            
  513.                                a        = 1,
  514.                                b        = 0,
  515.                                c        = 1,
  516.                                d        = 50,
  517.            
  518.  
  519.  
  520.  
  521.  
  522.         QRT Ray Tracer               Page 8           QRT Sample Programs
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.                                xmin     = -10,
  536.                                xmax     =  10,
  537.                                ymin     =   0,
  538.                                ymax     =  50,
  539.                                zmin     = -10,
  540.                                zmax     =   4,
  541.            
  542.                                diff     = (.7, 0, 0),
  543.                                dither   = 4,
  544.                                reflect  = .4,
  545.                                sreflect = 30
  546.                              )
  547.            
  548.            
  549.                END_BBOX
  550.            
  551.            { ** An observer ** }
  552.            
  553.            OBSERVER ( loc    = (40, 25, 30),
  554.                       lookat = (50, 0, -100)
  555.                     )
  556.            
  557.            { ** Two lamps ** }
  558.            
  559.            LAMP ( loc = (65, 70, 20),
  560.                   radius = 5,
  561.                   dist = 45
  562.                 )
  563.            
  564.            LAMP ( loc = (30, 55, -10),
  565.                   radius = 5,
  566.                   dist = 25
  567.                 )
  568.            
  569.            SKY  ( horiz  = (0, 0, .55),
  570.                   zenith = (0, 0, .25),
  571.                   dither = 4
  572.                 )
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.         QRT Ray Tracer               Page 9           QRT Sample Programs
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.